package com.handinglian.common.enums;

public enum LoginStateEnum {
    DISABLE(0,"禁用管理端登录"),
    ENABLE(1,"开启管理端登录");

    public static LoginStateEnum valueOfOrdinal(Integer ordinal) {
        return ordinal == null || ordinal >= values().length ? null : values()[ordinal];
    }
    public static LoginStateEnum valueOfDesc(String desc) {
        for(LoginStateEnum loginStateEnum : LoginStateEnum.values()){
            if(desc.equals(loginStateEnum.getDescription())){
                return loginStateEnum;
            }
        }
        return null;
    }
    public static LoginStateEnum valueOfKey(Integer key){
        for(LoginStateEnum loginStateEnum : LoginStateEnum.values()){
            if(loginStateEnum.getKey().equals(key)){
                return loginStateEnum;
            }
        }
        return null;
    }
    private final Integer key;
    private final String description;

    LoginStateEnum(Integer key, String description) {
        this.key = key;
        this.description = description;
    }

    public Integer getKey() {
        return key;
    }
    public String getDescription() {
        return this.description;
    }
}
